#sudo apt-get update && sudo apt-get install python ruby python3-pip git-lfs gcc-multilib g++-multilib zlib1g-dev libc++1 curl nodejs
#mkdir ~/bin/
#curl https://gitee.com/oschina/repo/raw/fork_flow/repo-py3 > ~/bin/repo
#chmod a+x ~/bin/repo
#export PATH=~/bin:$PATH
#pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple requests


repo init -u https://gitee.com/ark-standalone-build/manifest.git -b OpenHarmony_feature_20241108
repo sync -c -j8
repo forall -c 'git lfs pull'

./prebuilts_download.sh

#Next step is to build hybrid and hybrid_tests to obtain all necessary binaries to interop tests:
python ark.py x64.debug hybrid hybrid_tests

#python ark.py x64.debug hybrid hybrid_tests es2panda ark_js_vm ark_aot
#panda_bins ark_disasm es2panda arkquick verifier ark_aot ets-compile-stdlib-default ark

#Create build directory for static_core:
rm -rf arkcompiler/runtime_core/static_core/build
mkdir arkcompiler/runtime_core/static_core/build

#Prepare environment for copying binaries script running:
export DEV_HOME=`pwd`

export PANDA_BUILD_PATH=$DEV_HOME"/arkcompiler/runtime_core/static_core/build"
export ARK_STANDALONE_ROOT=$DEV_HOME

ln -s $DEV_HOME/arkcompiler/ets_frontend/ets2panda $DEV_HOME/arkcompiler/runtime_core/static_core/tools/es2panda

# Run script to copy all necessary binaries to static_core build:
./arkcompiler/runtime_core/static_core/tools/ark_js_napi_cli/standalone_cp_libs_for_interop_tests.sh debug

# Now we can going to static_core and run interop_tests with ArkJSVM:
cd arkcompiler/runtime_core/static_core/build
cmake .. -GNinja -DPANDA_ETS_INTEROP_JS=1 -DCMAKE_BUILD_TYPE=Debug -DPANDA_JS_ETS_HYBRID_MODE=1
ninja ets_interop_js_arkjsvm_gtests